#/bin/sh
UNISON=`ps -ef |grep -v grep|grep -c inotifywait`
if [ ${UNISON} -lt 1 ]
then
ip="10.126.84.136"
src="/opt/web/bi.t.58.com/resources/documents/"
dst="/opt/web/bi.t.58.com/resources/documents/"
inotifywait -mrq -e create,delete,modify,move $src |  while read line
do
unison -batch $src ssh://$ip//$dst
echo -n "$line " >>/opt/script/logs/inotify/inotify$(date +%u).log
echo `date +"%F %T" | cut -d" " -f1-4` >>/opt/script/logs/inotify/inotify$(date +%u).log
done
fi
